package org.custom.spring.boot.useless;

import cn.hutool.core.util.ObjectUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;
import java.util.Map;

/**
 * 定时任务相关实体类
 *
 * @author LiKun
 * @date 2021/7/30 23:39
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class QuartzJob {
    @ApiModelProperty(name = "job", notes = "定时任务")
    private String job;

    @ApiModelProperty(name = "corn", notes = "corn表达式")
    private String corn;

    @ApiModelProperty(name = "name", notes = "定时任务名称")
    private String name;

    @ApiModelProperty(name = "group", notes = "定时任务分组")
    private String group;

    @ApiModelProperty(name = "jobData", notes = "定时任务传递数据")
    private Map<String, Object> jobData;

    @ApiModelProperty(name = "startTime", notes = "定时任务开始时间")
    private Date startTime;

    public Date getStartTime() {
        this.startTime = ObjectUtil.isNull(startTime) ? new Date() : startTime;
        return this.startTime;
    }
}
